#include "configwidget.h"
#include <QApplication>
#include "common.h"

ConfigWidget::ConfigWidget(QScrollArea *parent)
    : QScrollArea(parent)
{
    setWindowFlags(Qt::FramelessWindowHint);
    setMinimumSize((Screen::GetScreenWidth())>>4, (Screen::GetScreenHeight())>>4);
    setMaximumSize(Screen::GetScreenSize());
    setFrameShape(QScrollArea::NoFrame);
    setWidgetResizable(true);

    m_tab_widget = new QTabWidget(this);
    m_tab_widget->setMinimumSize((Screen::GetScreenWidth())>>1, (Screen::GetScreenHeight())>>1);
    m_tab_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    setStyleSheet("background: rgb(248,248,248)");

    m_linereset_widget = new LineResetWidget(this);
    m_simulate_widget = new SimulateWidget(this);

    m_tab_widget->addTab(m_linereset_widget, QObject::tr("line param"));
    m_tab_widget->addTab(m_simulate_widget, QObject::tr("simulate run"));

    setWidget(m_tab_widget);

    m_tab_widget->setVisible(false);

    connect(m_linereset_widget, &LineResetWidget::reload_from_config, this, &ConfigWidget::reload_from_config);
}


void ConfigWidget::SimulateFindPic(QString path)
{
    //m_simulate_widget->simulate_find_pic(path);
}

void ConfigWidget::InitConfig()
{
    m_linereset_widget->initConfig();
    m_simulate_widget->add_id_combox();
    m_tab_widget->setVisible(true);
}
